import type { ClassifyEnum } from '@/enum'
import type { EnumValues } from '@/type/index'

export type ResultType<T> = {
  code: number
  msg: string
  data: T
}

export type PageVO<T> = {
  size: number
  current: number
  total: number
  isEmpty: boolean
  list: Array<T>
}

export const initPageVO = () => {
  return {
    size: 0,
    current: 0,
    total: 0,
    isEmpty: false,
    list: []
  }
}

export type PageDTO = {
  //每页数量
  size: number
  //当前页
  current: number
  //参数
  param: Record<string, any>
}

export const initPageDTO = () => {
  return {
    size: 10,
    current: 1,
    param: {}
  }
}

export type AccountDTO = {
  //用户名
  username: string
  //密码
  password: string
  //验证码
  code: string
  //邮箱
  email: string
  //新密码
  newPassword: string
}

// 使用工具类型生成ClassifyType
export type ClassifyType = EnumValues<typeof ClassifyEnum>
